function reply(textfieldId, commentId, userName) {
	var replyTextField = document.getElementById(textfieldId);
	replyTextField.value = "reply to " + userName + ":";

	var parentId = document.getElementById("parentId");
	parentId.value = commentId;
}

function add_comment(issueIndex, basePath, userId, userName, comment,
		commentId, time) {
	var tr = document.createElement('tr');
	var td1 = document.createElement('td');
	td1.innerHTML = "&nbsp;";
	var td2 = document.createElement('td');
	td2.innerHTML = "<a href='" + basePath + "user/get_user?userId=" + userId
			+ "'>" + userName + "</a>:" + comment;
	var td3 = document.createElement('td');
	var input = document.createElement('input');
	input.type = "button";
	input.value = "reply";
	input.onclick = function() {
		reply(commentId, userName);
	};
	td3.appendChild(input);
	var td4 = document.createElement('td');
	td4.innerHTML = time;

	tr.appendChild(td1);
	tr.appendChild(td2);
	tr.appendChild(td3);
	tr.appendChild(td4);

	var commentList=document.getElementById("commentList" + issueIndex);
	commentList.insertBefore(tr,commentList.firstChild);
	
	var replyTextField=document.getElementById("replyTextField" + issueIndex);
	replyTextField.value="";
}